/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package de.swa.testvalid.control;

import de.swa.testvalid.entity.MyUser;
import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;

/**
 *
 * @author felix
 */
@Stateless
public class UserRepository {
    @PersistenceContext(name="ValidTestPU")
    EntityManager em;

    public UserRepository() {
    }

    public MyUser addUser(MyUser user) {
        em.persist(user);
        return user;
    }
    public List<MyUser> getMember() {
        return em.createQuery("SELECT u FROM MyUser u", MyUser.class).getResultList();
    }
}

